﻿/*
 * Created by SharpDevelop.
 * User: ratul
 * Date: 3/4/2010
 * Time: 10:16 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using H264Impl.NET.Sample;

namespace H264Impl.NET
{
	/// <summary>
	/// Description of BlockFactory.
	/// </summary>
	public class BlockFactory
	{
		public BlockFactory()
		{
		}
		
		public enum BlockType
		{
			MACROBLOCK,
			SUB_MACROBLOCK
		}
		
		public const UInt32 macroblockWidth  = 16;
		public const UInt32 macroblockHeight = 16;
		
		public const UInt32 subMacroblockWidth  = 8;
		public const UInt32 subMacroblockHeight = 8;
		
		public Block createBlock(BlockType blockType, SampleArrayFactory.SamplingType samplingType, bool separateColorPlane)
		{
			Block block;
			if(blockType == BlockType.MACROBLOCK)
				block = new Block(samplingType, macroblockWidth, macroblockHeight, separateColorPlane);
			else if(blockType == BlockType.SUB_MACROBLOCK)
				block = new Block(samplingType, subMacroblockWidth, subMacroblockWidth, separateColorPlane);
			else
				throw new ArgumentException("blockType");
			return block;
			
		}
		
		
	}
}
